package com.whiteape.book.model.dto;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Index;

import java.io.Serializable;
import java.util.Objects;

import org.greenrobot.greendao.annotation.Generated;

@Entity
public class MediaChapterBean implements Serializable {
    private static final long serialVersionUID = 56423411313L;
    /**
     * 漫画暂时不支持本地漫画，所以就是url的md5
     */
    @Id
    private String id;

    private String link;
    /**
     * 当前章节的章节名
     */
    private String name;

    //所属的下载任务
    private String taskName;

    /**
     * 下载状态，参考 @link{DownloadStatus}
     */
    private int downloadStatus;

    //所属的书籍
    @Index
    private String mediaId;

    //本地书籍参数


    //在书籍文件中的起始位置
    private Long start;

    //在书籍文件中的终止位置
    private Long end;


    @Generated(hash = 791152793)
    public MediaChapterBean(String id, String link, String name, String taskName,
            int downloadStatus, String mediaId, Long start, Long end) {
        this.id = id;
        this.link = link;
        this.name = name;
        this.taskName = taskName;
        this.downloadStatus = downloadStatus;
        this.mediaId = mediaId;
        this.start = start;
        this.end = end;
    }

    @Generated(hash = 1813308253)
    public MediaChapterBean() {
    }

    public int getDownloadStatus() {
        return downloadStatus;
    }

    public void setDownloadStatus(int downloadStatus) {
        this.downloadStatus = downloadStatus;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getLink() {
        return link;
    }

    public void setLink(String link) {
        this.link = link;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getTaskName() {
        return taskName;
    }

    public void setTaskName(String taskName) {
        this.taskName = taskName;
    }

    public String getMediaId() {
        return mediaId;
    }

    public void setMediaId(String mediaId) {
        this.mediaId = mediaId;
    }

    public Long getStart() {
        return start;
    }

    public void setStart(Long start) {
        this.start = start;
    }

    public Long getEnd() {
        return end;
    }

    public void setEnd(Long end) {
        this.end = end;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        MediaChapterBean that = (MediaChapterBean) o;
        return Objects.equals(id, that.id);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id);
    }

    @Override
    public String toString() {
        return "MediaChapterBean{" +
                "id='" + id + '\'' +
                ", link='" + link + '\'' +
                ", name='" + name + '\'' +
                ", taskName='" + taskName + '\'' +
                ", downloadStatus=" + downloadStatus +
                ", mediaId='" + mediaId + '\'' +
                ", start=" + start +
                ", end=" + end +
                '}';
    }
}
